package com.apesay.utils;

import com.alibaba.fastjson.JSONObject;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

import java.util.Collection;

/**
 * ClassName:SessionUtils
 * Reason:	 
 * Date:     2016/12/15 11:25
 *
 * @author sid
 */
public class SessionUtils {
    public static String getUserId(){
        Session session = getSession();
        session.getAttributeKeys();
        JSONObject currentaccess = (JSONObject) session.getAttribute("currentaccount");
        return currentaccess.getString(Constant.OBJECTID);
    }
    public static Session getSession(){
        Subject subject = SecurityUtils.getSubject();
        return subject.getSession();
    }
}
